package sevensoft.行为型模式.备忘录模式.黑箱备忘录;



public class Demo {
    public static void main(String[] args) {
        Word word = new Word();
        word.setContent("hello~");
        System.out.println(word);
        //保存
        WordCaretaker wordCaretaker = new WordCaretaker();
        wordCaretaker.setMemento(word.save());
        //修改
        word.setContent("hesadascz");
        System.out.println(word);
        //还原
        word.recover(wordCaretaker.getMemento());
        System.out.println(word);
    }
}
